package com.hhit.brpc.service.impl;

import java.util.concurrent.Future;

import org.springframework.stereotype.Service;

import com.baidu.brpc.client.RpcCallback;
import com.baidu.brpc.spring.annotation.RpcProxy;
import com.hh.analyse.Analyse.AnalyseImageInfo;
import com.hh.analyse.Analyse.AnalyseImageResponse;
import com.hh.analyse.service.CommonAsyncService;
import com.hhit.brpc.service.BrpcCommonService;

import lombok.extern.log4j.Log4j2;

@Log4j2
@Service
public class BrpcCommonServiceImpl implements BrpcCommonService {
	@RpcProxy
	private CommonAsyncService commonAsyncService;

	public Future<AnalyseImageResponse> pushAnalyseImage(AnalyseImageInfo request) {
		
		
		
		Future<AnalyseImageResponse> future = commonAsyncService.pushAnalyseImage(request, new RpcCallback<AnalyseImageResponse>() {

			@Override
			public void success(AnalyseImageResponse response) {
				log.info("异步信息回调");
				log.info(response);
			}

			@Override
			public void fail(Throwable e) {
				e.printStackTrace();
				log.info(e.getMessage());
			}

		});
		return future;
	}

}
